package cn.jesin.css.vo;

import cn.jesin.css.entity.Creation;
import lombok.Data;

import java.util.Date;

/**
 * @author 谷汉斌
 * @description 返回给前端的作品信息
 * @createTime 2024/8/23 下午4:29
 */
@Data
public class CreationInfo {
    /**
     * 主键id
     */
    private Integer id;
    /**
     * 标题
     */
    private String title;
    /**
     * 描述
     */
    private String description;
    /**
     * 内容
     */
    private String content;
    /**
     * 作品封面
     */
    private String cover;
    /**
     * 视频
     */
    private String video;
    /**
     * 作品类型（文章，问题，视频）
     */
    private String type;
    /**
     * 作品标签
     */
    private String tag;
    /**
     * 点赞数
     */
    private Integer likeCount;
    /**
     * 不喜欢数
     */
    private Integer unlikeCount;
    /**
     * 收藏数
     */
    private Integer favoriteCount;
    /**
     * 作者
     */
    private String authorId;
    /**
     * 创建日期
     */
    private Date createTime;
    /**
     * 更新日期
     */
    private Date updateTime;
    /**
     * 是否完成
     */
    private Integer isFinish;
    /**
     * 浏览量
     */
    private Integer viewCount;
    /**
     * 讨论次数
     */
    private Integer commentCount;
    /**
     * 封面访问链接
     */
    private String coverUrl;


    /**
     * 当前用户是否点赞
     */
    private boolean isLike;
    /**
     * 当前用户是否收藏
     */
    private boolean isFavorite;

    public CreationInfo(Creation creation) {
        this.id = creation.getId();
        this.title = creation.getTitle();
        this.description = creation.getDescription();
        this.content = creation.getContent();
        this.cover = creation.getCover();
        this.video = creation.getVideo();
        this.type = creation.getType();
        this.tag = creation.getTag();
        this.likeCount = creation.getLikeCount();
        this.unlikeCount = creation.getUnlikeCount();
        this.favoriteCount = creation.getFavoriteCount();
        this.authorId = creation.getAuthorId();
        this.createTime = creation.getCreateTime();
        this.updateTime = creation.getUpdateTime();
        this.isFinish = creation.getIsFinish();
        this.viewCount = creation.getViewCount();
        this.commentCount = creation.getCommentCount();
        this.coverUrl = creation.getCoverUrl();
    }
}
